﻿using System;
using System.ServiceModel;
using Ayatta.Contract;
using Ayatta.Contract.Component;
using Ayatta.Contract.Domain;
using System.Collections.Generic;

namespace Ayatta.Contract
{
    [ServiceContract(Namespace = ServiceContract.Namespace)]
    public interface IStoreService : IService
    {
        [OperationContract]
        bool CreateProductCategory(ProductCategory o);

        [OperationContract]
        IList<ProductCategory> GetProductCategories(bool? status = null);

        [OperationContract]
        bool CreateProduct(Product o);

        [OperationContract]
        bool UpdateProduct(Product o);

        [OperationContract]
        bool DeleteProduct(long id);

        [OperationContract]
        Product GetProduct(long id, bool inclExtra = false, bool inclVariants = false);

        [OperationContract]
        PagedList<Product> GetPagedProductList(int size = 20, int index = 1, string name = null);

        [OperationContract]
        bool CreateProductAttributeName(ProductAttributeName attributeName);

        [OperationContract]
        IList<ProductAttributeName> GetProductAttributeName(string productCategoryCode, string parentAttributeNameCode,
                                                            int? id = null, bool? status = null);

        [OperationContract]
        bool CreateProductAttributeValue(ProductAttributeValue attributeValue);

        [OperationContract]
        IList<ProductAttributeValue> GetProductAttributeValue(string productCategoryCode, bool byAttributeNameCode,
                                                              string[] attributeNameCodeArray, int? id = null,
                                                              bool? status = null);

        #region Discount

        [OperationContract]
        bool CreateDiscount(Discount o);

        [OperationContract]
        Discount GetDiscount(int id);

        [OperationContract]
        PagedList<Discount> GetPagedDiscount(int size = 20, int index = 1, DiscountAssignedTo? assignedTo = null,
                                            bool? usePercentage = null, bool? status = null);

        [OperationContract]
        bool CreateDiscountRequirement(DiscountRequirement o);

        [OperationContract]
        IList<DiscountRequirement> GetDiscountRequirement(int discountId);

        //[OperationContract]
        //IList<Discount> GetAvailableDiscount();



        [OperationContract]
        bool ValidateDiscount(int discountId, int limitationTimes, int? userId);


        [OperationContract]
        IList<Discount> GetDiscounts(int userId);

        #endregion

        #region ProductAdvisory

        [OperationContract]
        bool CreateProductAdvisory(ProductAdvisory o);

        [OperationContract]
        bool UpdateProductAdvisory(ProductAdvisory o);

        [OperationContract]
        bool DeleteProductAdvisory(long id);

        [OperationContract]
        ProductAdvisory GetProductAdvisory(long id);

        [OperationContract]
        PagedList<ProductAdvisory> GetPagedProductAdvisory(int index = 1, int size = 20, long? productId = null,
                                                          int? userId = null, string createdBy = null,
                                                          DateTime? createdOn = null, DateTime? answerTime = null,
                                                          ProductAdvisoryCategory? category = null,
                                                          ProductAdvisoryStatus? status = null);

        #endregion

        #region ProductReview

        [OperationContract]
        bool CreateProductReview(ProductReview o);

        [OperationContract]
        bool UpdateProductReview(ProductReview o);

        [OperationContract]
        bool DeleteProductReview(long id);

        [OperationContract]
        ProductReview GetProductReview(long id);

        [OperationContract]
        PagedList<ProductReview> GetPagedProductReview(int index = 1, int size = 20, long? productId = null,
                                                      int? userId = null, string createdBy = null,
                                                      DateTime? createdOn = null,
                                                      ProductReviewStatus? status = null);

        #endregion

        #region ProductItem

        [OperationContract]
        ProductItem GetProductItem(int id, int? userId = null);

        [OperationContract]
        ProductItem GetProductItemName(int id);

        [OperationContract]
        ProductItem GetProductItemPriceQuantity(int id, int? userId = null);

        [OperationContract]
        int CreateProductItem(ProductItem o);

        [OperationContract]
        PagedList<ProductItem> GetPagedProductItems(int index = 1, int size = 20,byte param=0, int? userId = null, int? id = null, string name = null, string outerId = null, int? categoryRootId = null, decimal? priceFrom = null, decimal? priceTo = null, int? saleFrom = null, int? saleTo = null, IDictionary<string, string> orderBy = null);

        [OperationContract]
        bool UpdateProductItemName(int id, int userId, string name, string subName);

        [OperationContract]
        bool UpdateProductItemPrice(int id, int userId, decimal unitPrice, IDictionary<int, decimal> prices);

        [OperationContract]
        bool UpdateProductItemQuantity(int id, int userId, int quantity, IDictionary<int, int> quantities);

        [OperationContract]
        Sku GetSku(int id);

        #endregion
    }
}